// component/model/model.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    showModel: {
      // type: String,
      // observer:function(newVal,oldVal) {
      //   // this.showAmountModal()
      //   this.setData({
      //     showAmountModal: {
      //       showModal: 'showModal',
      //       showMask: 'showMask'
      //     }
      //   })
      // }
      type: Boolean,
      // observer: function (newVal, oldVal) {
      //   this.setData({
      //     showAmountModal: {
      //       showModal: 'showModal',
      //       showMask: 'showMask',
      //     }
      //   })
      // }
    },
    connect: {
      type: String
    },
    hasIcon: {
      type: Boolean,
      value: false
    },
    passParams: {
      type: Object,
      observer: function (newVal,oldVal) {
        console.log(newVal)
        this.setData({
          hasIcon: newVal.hasIcon,
          btnFont: newVal.btnFont,
          connect: newVal.connect
        })
      }
    }
  },
  created() {
    // this.showAmountModal()
  },
  ready() {
    // this.showAmountModal()
  },
  /**
   * 组件的初始数据
   */
  data: {
    showAmountModal: {
      showModal: 'showModal',
      showMask: 'showModal',
    },
    isSuccess: '恭喜您，提交成功',
    tips: '亲爱的“137****8895”，您提交的需求，大件君正在审核中！当期时间内的人数达到开团人数，我们将以短信的方式通知您',
    isBless: '祝您购物愉快',
    btnFont: '我的需求记录',
    hasIcon: false,
    connect: ''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // showAmountModal: function (e) {
    //   var that = this;
    //   that.setData({
    //     showAmountModal: {
    //       showModal: 'showModal',
    //       showMask: 'showMask',
    //     }
    //   })
      
    // },

    hideAmountModal: function (e) {
      // var that = this;
      // that.setData({
      //   showAmountModal: {
      //     showModal: 'hideModal',
      //     showMask: 'hideMask',
      //   },
      // })
      this.setData({ showModel: !this.properties.showModel})
      this.triggerEvent('showValue', this.properties.showModel)
    },
    cancel() {
      this.setData({ showModel: !this.properties.showModel })
      this.triggerEvent('showValue', this.properties.showModel)
    }
  }
})
